<html>
<head><meta charset="utf-8"><title>equality regions · t-compiler/wg-polonius · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/index.html">t-compiler/wg-polonius</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/equality.20regions.html">equality regions</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="175658629"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/equality%20regions/near/175658629" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/equality.20regions.html#175658629">(Sep 13 2019 at 19:54)</a>:</h4>
<p>Hey <span class="user-mention" data-user-id="116113">@lqd</span> -- where did you to do your experimentation with adding the "equality" stuff vs propagating all subsets?</p>



<a name="175658677"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/equality%20regions/near/175658677" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/equality.20regions.html#175658677">(Sep 13 2019 at 19:55)</a>:</h4>
<p>let me get you the link</p>



<a name="175658786"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/equality%20regions/near/175658786" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/equality.20regions.html#175658786">(Sep 13 2019 at 19:56)</a>:</h4>
<p>it's in an old-ish branch, before liveness was integrated, <a href="https://github.com/lqd/borrow-check/tree/variant_prototype" target="_blank" title="https://github.com/lqd/borrow-check/tree/variant_prototype">here</a></p>



<a name="175658858"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/equality%20regions/near/175658858" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/equality.20regions.html#175658858">(Sep 13 2019 at 19:57)</a>:</h4>
<p>there were <a href="https://hackmd.io/EqECXcd7TIGj97lVNc4dhw?view" target="_blank" title="https://hackmd.io/EqECXcd7TIGj97lVNc4dhw?view">notes</a> I had when we had the video call but I can't quite remember if they reflect the exact state of the branch</p>



<a name="175658944"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/equality%20regions/near/175658944" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/equality.20regions.html#175658944">(Sep 13 2019 at 19:58)</a>:</h4>
<p>which is: very hacky, some things were not working so I switched temporarily from doing some computations in datalog in rust just to eliminate a possible source of errors and have flexbility on how to compute equality / propagate it</p>



<a name="175658999"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/equality%20regions/near/175658999" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/equality.20regions.html#175658999">(Sep 13 2019 at 19:59)</a>:</h4>
<p>the propagation is likely wrong, as I didn't do a lot of experimentation / or ... thinking (and tests seemed to work)</p>



<a name="175659551"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/equality%20regions/near/175659551" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/equality.20regions.html#175659551">(Sep 13 2019 at 20:05)</a>:</h4>
<p>ok</p>



<a name="175659554"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/equality%20regions/near/175659554" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/equality.20regions.html#175659554">(Sep 13 2019 at 20:05)</a>:</h4>
<p>thanks!</p>



<a name="175659673"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/equality%20regions/near/175659673" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/equality.20regions.html#175659673">(Sep 13 2019 at 20:07)</a>:</h4>
<p>yw !</p>



<a name="175659814"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/equality%20regions/near/175659814" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/equality.20regions.html#175659814">(Sep 13 2019 at 20:08)</a>:</h4>
<p>(I didn't yet work through the other filtering of interesting regions/provenances I had done on the Naive variant which made it very fast, on this variant)</p>



<a name="175662467"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/equality%20regions/near/175662467" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/equality.20regions.html#175662467">(Sep 13 2019 at 20:44)</a>:</h4>
<p>ok so <span class="user-mention" data-user-id="116113">@lqd</span> I'm looking a bit at the code</p>



<a name="175662499"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/equality%20regions/near/175662499" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/equality.20regions.html#175662499">(Sep 13 2019 at 20:45)</a>:</h4>
<p>I remember that it was quite a bit slower but I don't recall how much we figured out about that</p>



<a name="175662509"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/equality%20regions/near/175662509" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/equality.20regions.html#175662509">(Sep 13 2019 at 20:45)</a>:</h4>
<p>the code is called lqd's monster</p>



<a name="175662519"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/equality%20regions/near/175662519" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/equality.20regions.html#175662519">(Sep 13 2019 at 20:45)</a>:</h4>
<p>it was slower in that it calculated a lot more subsets IIRC</p>



<a name="175662532"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/equality%20regions/near/175662532" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/equality.20regions.html#175662532">(Sep 13 2019 at 20:45)</a>:</h4>
<p>because of the transitive subset computation?</p>



<a name="175662539"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/equality%20regions/near/175662539" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/equality.20regions.html#175662539">(Sep 13 2019 at 20:45)</a>:</h4>
<p>then I added some early small-ish filtering, and it made fast again on clap</p>



<a name="175662544"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/equality%20regions/near/175662544" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/equality.20regions.html#175662544">(Sep 13 2019 at 20:45)</a>:</h4>
<p>yeah IIRC</p>



<a name="175662640"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/equality%20regions/near/175662640" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/equality.20regions.html#175662640">(Sep 13 2019 at 20:46)</a>:</h4>
<p>removing uninteresting loans helped the most / a lot IIRC</p>



<a name="175662682"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/equality%20regions/near/175662682" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/equality.20regions.html#175662682">(Sep 13 2019 at 20:47)</a>:</h4>
<p>yeah, that's probably something we should do anyway, though I imagine we might do it in polonius</p>



<a name="175662694"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/equality%20regions/near/175662694" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/equality.20regions.html#175662694">(Sep 13 2019 at 20:47)</a>:</h4>
<p>yeah esp in the Hybrid variant</p>



<a name="175662711"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/equality%20regions/near/175662711" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/equality.20regions.html#175662711">(Sep 13 2019 at 20:47)</a>:</h4>
<p>one thing that seems also true is that we could compute the <code>equality(N1, N2)</code> only if N1 &lt; N2, but that might be more annoying than it's worth</p>



<a name="175662804"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/equality%20regions/near/175662804" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/equality.20regions.html#175662804">(Sep 13 2019 at 20:48)</a>:</h4>
<p>but generally his theavy filtering (I have another filtering optimization elsewhere which removes most of the TC, it's only doing the TC on subset containing loans which were invalidated) helps a lot, so much so that I wondered if we still needed the Optimized variant</p>



<a name="175662839"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/equality%20regions/near/175662839" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/equality.20regions.html#175662839">(Sep 13 2019 at 20:49)</a>:</h4>
<p>but then that impacts the illegal subset relation errors</p>



<a name="175662877"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/equality%20regions/near/175662877" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/equality.20regions.html#175662877">(Sep 13 2019 at 20:49)</a>:</h4>
<p>by "heavy filtering", you are referring to the "non-interesting loans"?</p>



<a name="175662957"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/equality%20regions/near/175662957" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/equality.20regions.html#175662957">(Sep 13 2019 at 20:50)</a>:</h4>
<p>I guess there's really nothing <em>wrong</em> with the filtering</p>



<a name="175662981"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/equality%20regions/near/175662981" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/equality.20regions.html#175662981">(Sep 13 2019 at 20:50)</a>:</h4>
<p>well, it depends on which one we mean, but e.g. the rules to remove <code>(R, R)</code> subset relations seem "ok"</p>



<a name="175662984"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/equality%20regions/near/175662984" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/equality.20regions.html#175662984">(Sep 13 2019 at 20:50)</a>:</h4>
<p>these loans yes, but also limiting to "interesting regions"</p>



<a name="175663023"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/equality%20regions/near/175663023" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/equality.20regions.html#175663023">(Sep 13 2019 at 20:51)</a>:</h4>
<p>(I'll get you a link to the code that will be clearer I think)</p>



<a name="175663042"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/equality%20regions/near/175663042" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/equality.20regions.html#175663042">(Sep 13 2019 at 20:51)</a>:</h4>
<p>OK. I'm going to have to go in a bit, got a call</p>



<a name="175663129"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/equality%20regions/near/175663129" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/equality.20regions.html#175663129">(Sep 13 2019 at 20:52)</a>:</h4>
<p><a href="https://gist.github.com/lqd/3fafb888589a49f13a91a8ade9fd28cf#file-naive-wip-rs-L77-L116" target="_blank" title="https://gist.github.com/lqd/3fafb888589a49f13a91a8ade9fd28cf#file-naive-wip-rs-L77-L116">here it is</a></p>



<a name="175663173"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/equality%20regions/near/175663173" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/equality.20regions.html#175663173">(Sep 13 2019 at 20:53)</a>:</h4>
<p>and of course the <code>requires.insert(interesting_borrow_region);</code></p>



<a name="175663331"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/equality%20regions/near/175663331" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/equality.20regions.html#175663331">(Sep 13 2019 at 20:55)</a>:</h4>
<p>ah</p>



<a name="175663332"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/equality%20regions/near/175663332" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/equality.20regions.html#175663332">(Sep 13 2019 at 20:55)</a>:</h4>
<p>it helps a lot on clap but probably it's not the worst use-case, the ongoing benchmarking will clear that up; at least rustc tests pass with it, a bit reassuring but we'll see :)</p>



<a name="175663340"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/equality%20regions/near/175663340" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/equality.20regions.html#175663340">(Sep 13 2019 at 20:55)</a>:</h4>
<p>yeah</p>



<a name="175663341"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/equality%20regions/near/175663341" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/equality.20regions.html#175663341">(Sep 13 2019 at 20:55)</a>:</h4>
<p>that's nice, though</p>



<a name="175663355"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/equality%20regions/near/175663355" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/equality.20regions.html#175663355">(Sep 13 2019 at 20:55)</a>:</h4>
<p>we do a similar opt in NLL but I like how this kind of "flows out" from the invalidation facts</p>



<a name="175663407"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/equality%20regions/near/175663407" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/equality.20regions.html#175663407">(Sep 13 2019 at 20:56)</a>:</h4>
<p>it's really just filtering before doing the joins</p>



<a name="175663432"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/equality%20regions/near/175663432" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/equality.20regions.html#175663432">(Sep 13 2019 at 20:56)</a>:</h4>
<p>instead of <em>after</em></p>



<a name="175663441"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/equality%20regions/near/175663441" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/equality.20regions.html#175663441">(Sep 13 2019 at 20:56)</a>:</h4>
<p>right</p>



<a name="175663448"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/equality%20regions/near/175663448" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/equality.20regions.html#175663448">(Sep 13 2019 at 20:56)</a>:</h4>
<p>well i'd be happy if we can wind up with something closer to the naive rules ;)</p>



<a name="175663450"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/equality%20regions/near/175663450" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/equality.20regions.html#175663450">(Sep 13 2019 at 20:56)</a>:</h4>
<p>but ofc "illegal subset relation errors" might need the intermediate computations :/</p>



<a name="175663469"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/equality%20regions/near/175663469" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/equality.20regions.html#175663469">(Sep 13 2019 at 20:56)</a>:</h4>
<p>haha yeah me too :)</p>



<a name="175663483"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/equality%20regions/near/175663483" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/equality.20regions.html#175663483">(Sep 13 2019 at 20:57)</a>:</h4>
<p>it seemed faster than the location_insensitive variant on clap</p>



<a name="175663495"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/equality%20regions/near/175663495" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/equality.20regions.html#175663495">(Sep 13 2019 at 20:57)</a>:</h4>
<p>I remember thinking that this was part of the promise of equality tracking though</p>



<a name="175663520"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/equality%20regions/near/175663520" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/equality.20regions.html#175663520">(Sep 13 2019 at 20:57)</a>:</h4>
<p>ofc this could be combined with location-insensitive, too</p>



<a name="175663534"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/equality%20regions/near/175663534" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/equality.20regions.html#175663534">(Sep 13 2019 at 20:57)</a>:</h4>
<p>yes I ahve it elsewhere as well</p>



<a name="175663588"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/equality%20regions/near/175663588" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/equality.20regions.html#175663588">(Sep 13 2019 at 20:58)</a>:</h4>
<p>I'm torn; I'm feeling some sort of desire to delete all the "semi-optimized variants" and get back to naive though</p>



<a name="175663597"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/equality%20regions/near/175663597" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/equality.20regions.html#175663597">(Sep 13 2019 at 20:58)</a>:</h4>
<p>part of it yes was in the equality-tracking variant, in total I think 2-3 relations were filtered, this one has all the filters, the eq-tracking one only 1 I think</p>



<a name="175663609"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/equality%20regions/near/175663609" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/equality.20regions.html#175663609">(Sep 13 2019 at 20:58)</a>:</h4>
<p>e.g., delete datafrog-opt, hybrid, location-insensitive, clean up the naive to work just how we want it, and then try to optimize again</p>



<a name="175663629"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/equality%20regions/near/175663629" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/equality.20regions.html#175663629">(Sep 13 2019 at 20:58)</a>:</h4>
<p>but man that can be awfully slow :P</p>



<a name="175663635"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/equality%20regions/near/175663635" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/equality.20regions.html#175663635">(Sep 13 2019 at 20:58)</a>:</h4>
<p>:)</p>



<a name="175663642"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/equality%20regions/near/175663642" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/equality.20regions.html#175663642">(Sep 13 2019 at 20:58)</a>:</h4>
<p>but if we can do some judicious filtering like that, it might work</p>



<a name="175663657"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/equality%20regions/near/175663657" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/equality.20regions.html#175663657">(Sep 13 2019 at 20:59)</a>:</h4>
<p>we could do that, but maybe just wait until we have the illegal subsets a bit more planned out</p>



<a name="175663714"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/equality%20regions/near/175663714" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/equality.20regions.html#175663714">(Sep 13 2019 at 20:59)</a>:</h4>
<p>esp I wondered about the placeholder loans and what will that end up needing wrt intermediate computations of subsets and all</p>



<a name="175663768"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/equality%20regions/near/175663768" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/equality.20regions.html#175663768">(Sep 13 2019 at 21:00)</a>:</h4>
<p>yeah ok next time I carve out some time I'll try to mock up what that means</p>



<a name="175663784"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/equality%20regions/near/175663784" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/equality.20regions.html#175663784">(Sep 13 2019 at 21:00)</a>:</h4>
<p>I feel pretty sure we want placeholder loans tho</p>



<a name="175663795"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/equality%20regions/near/175663795" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/equality.20regions.html#175663795">(Sep 13 2019 at 21:00)</a>:</h4>
<p>seems likely indeed</p>



<a name="175663800"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/equality%20regions/near/175663800" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/equality.20regions.html#175663800">(Sep 13 2019 at 21:00)</a>:</h4>
<p>I think we want to be able to say that the polonius loop "computes" the set of loans represented by each origin at each point</p>



<a name="175663807"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/equality%20regions/near/175663807" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/equality.20regions.html#175663807">(Sep 13 2019 at 21:00)</a>:</h4>
<p>vs also computing this auxiliary subset thing</p>



<a name="175663818"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/equality%20regions/near/175663818" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/equality.20regions.html#175663818">(Sep 13 2019 at 21:00)</a>:</h4>
<p>I can't remember if there was another reason more than just "it feels better", maybe connected to this equality stuff? anyway gotta go</p>



<a name="175663824"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/equality%20regions/near/175663824" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/equality.20regions.html#175663824">(Sep 13 2019 at 21:00)</a>:</h4>
<p>it seems sensible</p>



<a name="175663829"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/equality%20regions/near/175663829" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/equality.20regions.html#175663829">(Sep 13 2019 at 21:01)</a>:</h4>
<p>if nothing else though it maps to oxide better :)</p>



<a name="175663843"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/equality%20regions/near/175663843" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/equality.20regions.html#175663843">(Sep 13 2019 at 21:01)</a>:</h4>
<p>which feels like a good reason</p>



<a name="175663848"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/equality%20regions/near/175663848" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/equality.20regions.html#175663848">(Sep 13 2019 at 21:01)</a>:</h4>
<p>alright cheers niko, enjoy the weekend :)</p>



<a name="175663855"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/equality%20regions/near/175663855" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/equality.20regions.html#175663855">(Sep 13 2019 at 21:01)</a>:</h4>
<p>oh yeah for sure</p>



<a name="175664663"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/equality%20regions/near/175664663" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/equality.20regions.html#175664663">(Sep 13 2019 at 21:13)</a>:</h4>
<p>(for anyone following at home, the naive rules kinda do 2 TCs, and then filter on static inputs; the previous code is about limiting the amount of work done in the 2 TCs by filtering with these static inputs before the TC, instead of after — obvious in retrospect, but some other analysis possibly needing some of the data made this hard to notice for a year :)</p>



<a name="176212299"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/equality%20regions/near/176212299" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/equality.20regions.html#176212299">(Sep 20 2019 at 17:17)</a>:</h4>
<p>I cleaned up the equality prototype a bit, as it used to rely on features of my datafrog fork, and rebased over master</p>



<a name="176212324"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/equality%20regions/near/176212324" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/equality.20regions.html#176212324">(Sep 20 2019 at 17:17)</a>:</h4>
<p>the branch is at <a href="https://github.com/lqd/borrow-check/tree/variant_prototype2" target="_blank" title="https://github.com/lqd/borrow-check/tree/variant_prototype2">https://github.com/lqd/borrow-check/tree/variant_prototype2</a></p>



<a name="176212446"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/equality%20regions/near/176212446" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/equality.20regions.html#176212446">(Sep 20 2019 at 17:18)</a>:</h4>
<p>this time it has both versions, with a bool you can toggle in the prototype variant to choose between the 2, and includes the subset/requires filtering, otherwise rustc tests were too slow, and a new input set for all the test cases we mentioned along the way (the "polonius-imprecision" dataset)</p>



<a name="176212489"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/equality%20regions/near/176212489" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/equality.20regions.html#176212489">(Sep 20 2019 at 17:18)</a>:</h4>
<p>version 1, implemented from Niko's 1st comment (with itself containing a known imprecision fixed by Niko's 2nd comment): "static equality". TLDR: it kinda works, indeed fixes the "polonius-imprecision/unnecessary_error" test (but ofc fails the "polonius-imprecision/flow_sensitive_equality_required" case causing the 2nd version to exist). However, 2 rustc tests fail when trying it out for real (2 cases which are expected to fail but do compile)</p>



<a name="176212556"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/equality%20regions/near/176212556" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/equality.20regions.html#176212556">(Sep 20 2019 at 17:19)</a>:</h4>
<p>version 2, derived from Niko's 2nd comment: "flow sensitive equality". TLDR: indeed passes the "polonius-imprecision/flow_sensitive_equality_required" case but works a bit less overall for now, as it eg fails on the "polonius-imprecision/cycle_unification" test where it doesn't detect the error, which I hadn't noticed before. Trying it out in rustc, 16 tests fail (a mix of tests which shouldn't compile but do, and others with less errors than expected) including both from the previous version.</p>



<a name="176212749"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/equality%20regions/near/176212749" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/equality.20regions.html#176212749">(Sep 20 2019 at 17:21)</a>:</h4>
<p>so the plan is to locate the source of the 2 errors of v1, because it seems related to equality rather than its flow-sensitivity or lack thereof (or a mistake in both versions), and debug/understand why v2 fails to find the error on "cycle_unification"</p>



<a name="176220739"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/equality%20regions/near/176220739" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/equality.20regions.html#176220739">(Sep 20 2019 at 18:54)</a>:</h4>
<blockquote>
<p>I cleaned up the equality prototype a bit, as it used to rely on features of my datafrog fork, and rebased over master</p>
</blockquote>
<p>Is there a reason why you can't merge your Datafrog fork?</p>



<a name="176220753"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/equality%20regions/near/176220753" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/equality.20regions.html#176220753">(Sep 20 2019 at 18:54)</a>:</h4>
<p>(I assume there is, but I'm curious)</p>



<a name="176220990"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/equality%20regions/near/176220990" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/equality.20regions.html#176220990">(Sep 20 2019 at 18:57)</a>:</h4>
<p>it's mostly in an experimental state, there's no reason per se, rather than needing to do the work to complete / reject the experiments. in this case it was about having 1 leaper (easy to upstream if needed, but not super important) and dumping all the tuples datafrog creates à la datalog provenance but done on the cheap</p>



<a name="176221281"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/equality%20regions/near/176221281" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/equality.20regions.html#176221281">(Sep 20 2019 at 19:00)</a>:</h4>
<p>(I mentioned this because if someone checked out the previous branch it wouldn't build without a bit of massaging — which I've done in the new one)</p>



<a name="176258297"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/equality%20regions/near/176258297" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/equality.20regions.html#176258297">(Sep 21 2019 at 09:55)</a>:</h4>
<p>I think figured out problem 2: flow sensitive equality was dependent on liveness across edges (like the requires relation) but it shouldn’t IIUC, with that fixed it should work the on cycle_unification test case (funnily enough, that rule could now use Leapers of size 1 :)</p>



<a name="176376808"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/equality%20regions/near/176376808" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/equality.20regions.html#176376808">(Sep 23 2019 at 15:03)</a>:</h4>
<blockquote>
<p>Niko: I think we want to be able to say that the polonius loop "computes" the set of loans represented by each origin at each point</p>
</blockquote>
<p>for a "minimal subset" of loans/origins/points actually needed to detect errors, right ?</p>



<a name="176521909"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/equality%20regions/near/176521909" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/equality.20regions.html#176521909">(Sep 25 2019 at 00:22)</a>:</h4>
<p>also this begs the question <span class="user-mention" data-user-id="116009">@nikomatsakis</span>, if we <em>had to choose</em> between 1) what we have today with the <a href="https://github.com/lqd/borrow-check/blob/variant_prototype2/inputs/polonius-imprecision/polonius-imprecision.rs#L4-L22" target="_blank" title="https://github.com/lqd/borrow-check/blob/variant_prototype2/inputs/polonius-imprecision/polonius-imprecision.rs#L4-L22">"unnecessary_error" caveat</a> that NLL also has, or 2) the prototype as initially described in <a href="https://github.com/rust-lang/polonius/issues/107#issue-452778031" target="_blank" title="https://github.com/rust-lang/polonius/issues/107#issue-452778031">issue #120</a> with the <a href="https://github.com/lqd/borrow-check/blob/variant_prototype2/inputs/polonius-imprecision/polonius-imprecision.rs#L43-L62" target="_blank" title="https://github.com/lqd/borrow-check/blob/variant_prototype2/inputs/polonius-imprecision/polonius-imprecision.rs#L43-L62">"flow_sensitive_equality_required" caveat</a> from the second comment, and that option 1 doesn't have but NLL has, or 3) "flow sensitive equality" as the solution to both previous options caveats with the doubts that flow-sensitivity may be hard to pull off, what would we choose ? :)</p>



<a name="176522008"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/equality%20regions/near/176522008" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/equality.20regions.html#176522008">(Sep 25 2019 at 00:25)</a>:</h4>
<p>(by "may be hard to pull off" I mean 50-500k equality tuples flowing through 50k+ CFGs is slow rn — eg too slow to complete <code>clap</code> again, like option 2 before the interestingness filtering; maybe there can be similar judicious filtering to apply here, maybe increasing the granularity to blocks, maybe partially propagating equality of an origin who is equated to different origins at different points)</p>



<a name="176522107"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/equality%20regions/near/176522107" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/equality.20regions.html#176522107">(Sep 25 2019 at 00:27)</a>:</h4>
<p>(maybe just buggy :)</p>



<a name="176524012"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/equality%20regions/near/176524012" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/equality.20regions.html#176524012">(Sep 25 2019 at 01:02)</a>:</h4>
<p>(deleted)</p>



<a name="177088353"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/equality%20regions/near/177088353" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/equality.20regions.html#177088353">(Oct 01 2019 at 19:17)</a>:</h4>
<p>I refuse to choose :P</p>



<a name="177088412"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/equality%20regions/near/177088412" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/equality.20regions.html#177088412">(Oct 01 2019 at 19:18)</a>:</h4>
<p>I can't really understand why equality tuples should be harder than the subset tuples we had before</p>



<a name="177088417"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/equality%20regions/near/177088417" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/equality.20regions.html#177088417">(Oct 01 2019 at 19:18)</a>:</h4>
<p>Something is confusing to me</p>



<a name="177089921"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/equality%20regions/near/177089921" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/equality.20regions.html#177089921">(Oct 01 2019 at 19:35)</a>:</h4>
<p>maybe it's doing the TC before propagating it, but something is fishy indeed</p>



<a name="177090000"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/equality%20regions/near/177090000" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/equality.20regions.html#177090000">(Oct 01 2019 at 19:36)</a>:</h4>
<p>I'll look into it more</p>



<a name="177090205"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/equality%20regions/near/177090205" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/equality.20regions.html#177090205">(Oct 01 2019 at 19:38)</a>:</h4>
<p>(and look at making the rules better utilize the fact that equality is symmetric, as right now we'll have both values in the facts)</p>



<a name="177090260"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/equality%20regions/near/177090260" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/equality.20regions.html#177090260">(Oct 01 2019 at 19:39)</a>:</h4>
<p><em>stomping fist on table</em> I shall investigate !</p>



<a name="177797983"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/equality%20regions/near/177797983" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/equality.20regions.html#177797983">(Oct 10 2019 at 10:48)</a>:</h4>
<p>here's the data I mentioned tuesday:<br>
- the <a href="https://gist.github.com/lqd/daf89ef74917a595e7fb68bc0f890fb6#file-cycle_unification-mir" target="_blank" title="https://gist.github.com/lqd/daf89ef74917a595e7fb68bc0f890fb6#file-cycle_unification-mir">MIR</a>, <br>
- a filtered <a href="https://gist.github.com/lqd/daf89ef74917a595e7fb68bc0f890fb6#file-vizualisation-dot" target="_blank" title="https://gist.github.com/lqd/daf89ef74917a595e7fb68bc0f890fb6#file-vizualisation-dot">graphviz file</a> output to remove the liveness facts cause they're not the problem here (but which reminds me we still keep in-memory even after computing it, and we'll solve that when moving to a more pipeline-ish process). <br>
- note that the source is <a href="https://gist.github.com/lqd/daf89ef74917a595e7fb68bc0f890fb6#file-input_code-rs" target="_blank" title="https://gist.github.com/lqd/daf89ef74917a595e7fb68bc0f890fb6#file-input_code-rs">this</a> where I've removed type ascription to simplify the MIR and remove a bunch of facts</p>
<p>the missed error is at bb10[0], and the live loan is "L1": bw1; so we can ignore all the L0 and L2 facts (I can filter them out of the graphviz if need be), the origin we're interested in is '11</p>



<a name="177798843"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/equality%20regions/near/177798843" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/equality.20regions.html#177798843">(Oct 10 2019 at 11:02)</a>:</h4>
<p>we can see that '11 is equated with '16 at bb7[3], itself being equated to '19 at bb7[10]. L1 is in '9, '19, '20, '23 at the call site, and none of those will be live at the error site</p>



<a name="177799120"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/equality%20regions/near/177799120" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/equality.20regions.html#177799120">(Oct 10 2019 at 11:07)</a>:</h4>
<p>(L1 is mostly in '17 from its creation (bb7[6]) until just before the call at bb7[12] where it flows into '20)</p>



<a name="177800023"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/equality%20regions/near/177800023" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/equality.20regions.html#177800023">(Oct 10 2019 at 11:22)</a>:</h4>
<p>(I'll add equality tuples to the graphviz, it's not clear enough otherwise -- edit: done)</p>



<a name="177801480"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/equality%20regions/near/177801480" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/equality.20regions.html#177801480">(Oct 10 2019 at 11:49)</a>:</h4>
<p>what usually happens: '11 and '16 are joined in equality by '19 at bb7[10], where '16 dies; at the call site '20 flows into '9, then '19 and into '11 which we wanted</p>



<a name="177801645"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/equality%20regions/near/177801645" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/equality.20regions.html#177801645">(Oct 10 2019 at 11:53)</a>:</h4>
<p>here there should be an equality TC at bb7[10] otherwise that link is lost</p>



<a name="177804734"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/equality%20regions/near/177804734" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/equality.20regions.html#177804734">(Oct 10 2019 at 12:37)</a>:</h4>
<p>(sorry, I'm back, I had to go buy a house :p)</p>



<a name="177809171"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/equality%20regions/near/177809171" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/equality.20regions.html#177809171">(Oct 10 2019 at 13:25)</a>:</h4>
<p>and with that, we're back in business</p>



<a name="177809438"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/equality%20regions/near/177809438" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/equality.20regions.html#177809438">(Oct 10 2019 at 13:28)</a>:</h4>
<p>(I can't really test clap, there's data missing in the repo since liveness landed; I'll try to add that back and then test it out; and run rustc's tests as well)</p>



<a name="177823183"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/equality%20regions/near/177823183" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/equality.20regions.html#177823183">(Oct 10 2019 at 15:45)</a>:</h4>
<p>rustc results: a couple more OOM/huge memory uses (some possibly unrelated to this variant, where other variants seem to also use a lot of memory, and could bypass the problem via location insensitivity; and others which only happend with the prototype), 2 cases which now start compiling:<br>
- first, <a href="https://github.com/rust-lang/rust/blob/master/src/test/ui/borrowck/mut-borrow-in-loop.rs" target="_blank" title="https://github.com/rust-lang/rust/blob/master/src/test/ui/borrowck/mut-borrow-in-loop.rs">borrowck/mut-borrow-in-loop.rs</a>: borrowing in an infinite loop, and which seems unclear to me from a cursory look (like, it seems the loan could only last for the call and not continue into the next iteration ?)<br>
- and <a href="https://github.com/rust-lang/rust/blob/master/src/test/ui/nll/promoted-bounds.rs" target="_blank" title="https://github.com/rust-lang/rust/blob/master/src/test/ui/nll/promoted-bounds.rs">nll/promoted-bounds.rs</a> which feels like it shouldn't compile tho :p</p>
<p>so there's surely some other bugs lurking in there still</p>



<a name="177858247"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/equality%20regions/near/177858247" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/equality.20regions.html#177858247">(Oct 10 2019 at 22:07)</a>:</h4>
<p>apart from that, <a href="https://github.com/lqd/borrow-check/blob/variant_prototype2/polonius-engine/src/output/prototype.rs" target="_blank" title="https://github.com/lqd/borrow-check/blob/variant_prototype2/polonius-engine/src/output/prototype.rs">here's how it looks</a> with help from the datapond generator (and manually converted to leapjoins, indices removed, etc), and perf seems ok (with interesting-ness filtering ofc)</p>



<a name="178224956"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/equality%20regions/near/178224956" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Matthew Jasper <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/equality.20regions.html#178224956">(Oct 15 2019 at 19:14)</a>:</h4>
<p>Both examples should fail to compile. The functions in the loops have to borrow the reference for <code>'a</code>because of their types (although it's pretty hard to make a function pointer where this is a problem).</p>



<a name="178225058"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/equality%20regions/near/178225058" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/equality.20regions.html#178225058">(Oct 15 2019 at 19:15)</a>:</h4>
<p>thanks <span class="user-mention" data-user-id="116118">@Matthew Jasper</span> I'll analyze those in more detail then and see where the rules break down</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>